const { Sequelize } = require("sequelize");
const path = require("node:path");
const datasource = new Sequelize('plan-manager', null, null, {
	dialect: 'sqlite',
	storage: path.join(process.env.USERPROFILE, 'plan-manager.db')
})

module.exports = {
	datasource
}

module.exports.Task = require('./entity/task.cjs').Task
module.exports.Setting = require('./entity/setting.cjs').Setting
module.exports.Asset = require('./entity/asset.cjs').Asset

datasource.sync().then(() => {
	console.log('database initialized')
}).catch((err) => {
	console.log('database initialize fail', err)
})
